﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Libs.Content;
using Libs.Utils;

public partial class Pages_News_Detail : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        int cateID = 0, newsID = 0;
        if (!NewsUtils.CheckUrl(ref cateID, ref newsID))
        {
            Response.Redirect(Constant.HOME_PATH);
        }

        NewsCategories _Cate = new NewsCategories();
        _Cate = _Cate.Get(cateID);
        if (_Cate.CateID == 0)
        {
            Response.Redirect(Constant.HOME_PATH);
        }
        News _News = new News();
        _News = _News.Get(newsID);
        if (_News.NewsID == 0 || _News.Status != 3)
        {
            Response.Redirect(Constant.HOME_PATH);
        }

        lblTime.Text = DateTimeUtils.ReadTime(_News.PublishedTime);
        lblTitle.Text = _News.Title;
        Title = _News.Title + " - " + Title;
        ltrContent.Text = _News.Content;
        hlCate.NavigateUrl = NewsUtils.CateLink(cateID.ToString(), _Cate.Url, "0");
        hlCate.Text = _Cate.Name;
        //ltrTags.Text = Tags(_News.Tags);

        NewsWeb _NewsWeb = new NewsWeb();
        rptNewList.DataSource = _NewsWeb.GetList(_Cate.CateID, _News.NewsID, 10);
        rptNewList.DataBind();

    }
}